how to create api with nextjs